package com.bua.control;

import com.bua.toothfactory.R;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;

public class ImageLableButton extends LinearLayout {

	private ImageButton imageButton;
	private TextView tvTitle;
	public ImageLableButton(Context context) {
		super(context);
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		inflater.inflate(R.layout.image_lable_button, this);

		imageButton = (ImageButton) findViewById(R.id.buttonImage);
		tvTitle = (TextView) findViewById(R.id.Title);

	}

	public ImageLableButton(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(R.layout.image_lable_button, this);

		imageButton = (ImageButton) findViewById(R.id.buttonImage);
		tvTitle = (TextView) findViewById(R.id.Title);
	}

	/**
	 * ����ͼƬ��Դ
	 */
	public void setImage(Bitmap image) {
		imageButton.setImageBitmap(image);
	}

	/**
	 * ������ʾ������
	 */
	public void setTitle(String text) {
		tvTitle.setText(text);
	}

	@Override
	public void setOnClickListener(OnClickListener l) {

		imageButton.setOnClickListener(l);

	}

}
